$OpenBSD: patch-dcmqrdb_apps_dcmqrscp_cc,v 1.1 2014/06/04 13:15:17 jasper Exp $

Security fix for CVE-2013-6825, DCMTK Root Privilege escalation
http://hmarco.org/bugs/dcmtk-3.6.1-privilege-escalation.html

--- dcmqrdb/apps/dcmqrscp.cc.orig	Fri Dec 16 13:39:13 2005
+++ dcmqrdb/apps/dcmqrscp.cc	Wed Jun  4 13:31:35 2014
@@ -598,7 +598,10 @@ main(int argc, char *argv[])
      * and run by another user.  Running as root user may be
      * potentially disasterous if this program screws up badly.
      */
-    setuid(getuid());
+    if( setuid(getuid()) != 0){
+       CERR << "Failed to drop privileges";
+       return -1;
+    }
 #endif
 
 #if defined(HAVE_GETGRNAM) && defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
